<?php
declare(strict_types=1);
namespace App\Controller\Api\V1\Cms;

use App\Controller\Api\BaseController;
use App\Model\CmsCategory;
use App\Repositories\CmsCategoryRepository;

class CategoryController extends BaseController
{
    public function all(){
        $search=[[
            'field'=>'parent_id',
            'value'=>0
        ],[
            'field'=>'module',
            'value' => CmsCategory::MODULE_ARTICLE
        ]];
        $orderBy=[[
            'field' => 'listorder',
            'sort' => 'asc'
        ]];
        $return = CmsCategoryRepository::getInstance()->getList('*',$search,[],$orderBy);
        return $this->response->success($return);
    }
}